package com.zhuss.controller.team;

import com.zhuss.bean.bo.team.publish.CreatePublishBo;
import com.zhuss.bean.bo.team.publish.UnderPublishBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.WpsException;
import com.zhuss.team.publish.PublishOperateServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhushanshuo
 * @Date: 2020/3/30 16:30
 */
@RestController
@RequestMapping("/publish")
public class PublishOperateController extends BaseController {

    @Autowired
    @Qualifier("publishOperateService")
    private OperateService<Void, Object> publishOperateService;

    @Autowired
    @Qualifier("publishOperateServiceExt")
    private PublishOperateServiceExt publishOperateServiceExt;

    /**
     * 新建
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreatePublishBo bo) throws WpsException {
        publishOperateService.create(bo);
    }

    /**
     * 下架发布
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/under")
    public void under(@RequestBody UnderPublishBo bo) throws WpsException {
        publishOperateServiceExt.under(bo);
    }

}
